//
//  MineCell.m
//  FreeTravel
//
//  Created by 徐康 on 16/8/30.
//  Copyright © 2016年 KX. All rights reserved.
//
#import "Masonry.h"
#import "MineCell.h"
@interface MineCell ()
@property (nonatomic, strong) UIImageView *imageViewOfRight;
@property (nonatomic, strong) UIImageView *imageViewOfFront;
@property (nonatomic, strong) UILabel *label;
@end
@implementation MineCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewOfFront = [[UIImageView alloc]init];
        self.imageViewOfRight = [[UIImageView alloc]init];
        self.label = [[UILabel alloc]init];
        [self.contentView addSubview:self.imageViewOfRight];
        [self.contentView addSubview:self.imageViewOfFront];
        [self.contentView addSubview:self.label];
        
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    [_imageViewOfFront mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(30);
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView.mas_left).mas_offset(10);
    }];
    [_imageViewOfRight mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.mas_right).mas_offset(-10);
        make.width.height.mas_equalTo(20);
    }];
    [_label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(_imageViewOfFront.mas_right).mas_offset(10);
        make.right.equalTo(_imageViewOfRight.mas_left).mas_offset(10);
        make.height.mas_equalTo(20);
    }];
}
- (void)setModel:(MineModel *)model{
    
    self.imageViewOfFront.image = [UIImage imageNamed:model.stringOfImage];
    self.imageViewOfRight.image = [UIImage imageNamed:@"xiangyou"];
    self.label.text = model.name;
}
@end
